import { createApp } from "vue";
import App from "./App.vue";
import router from "./router/index.js";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import "normalize.css"; //重置样式
import * as ElementPlusIconsVue from "@element-plus/icons-vue"; //引入所有字体图标组件
import store from "./store/index.js";
import ImgUpload from "./components/img-upload.vue";
import Cloud from "leancloud-storage";
import "animate.css";
//尝试提取本地存储的用户信息
let info = localStorage.getItem("vue-admin-2302");
if (info) {
  store.commit("user/initInfoMut", JSON.parse(info));
}
// LeanCloudSDK初始化
Cloud.init({
  appId: "AOAqmOyzZ7j9d5VfwCAw8C3H-gzGzoHsz", //使用自己的ID
  appKey: "iQkDgL9lUAzccFiGLq9d7cFg", //使用自己的Key
  serverURL: "https://aoaqmoyz.lc-cn-n1-shared.com",
});

let app = createApp(App);
app.component("img-upload", ImgUpload);
app.use(router); //路由注入
app.use(store); //注入状态机
app.use(ElementPlus);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component); //全局注册
}
app.mount("#app");
